package com.laf.mall.api.dto;

import lombok.Data;
import org.springframework.jdbc.core.RowMapper;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author ygl
 * @create 2018-12-27
 * @DESCRIPTION
 * 停车抵扣规则
 **/
@Data
public class ParkingRule implements RowMapper<ParkingRule>, Serializable {

    private Integer id;
    /**
     * 每一元对应多少积分
     */
    private Integer pointsPerYuan;

    /**
     * 最多可以抵扣的元
     */
    private Integer mostYuan;

    /**
     * 接口查询时扣除积分，超过冻结时间将重新记录数据
     */
    private Integer frozenTime;

    @Override
    public ParkingRule mapRow(ResultSet rs, int rowNum) throws SQLException {
        ParkingRule model = new ParkingRule();
        model.setId(rs.getInt("id"));
        model.setPointsPerYuan(rs.getInt("points_per_yuan"));
        model.setMostYuan(rs.getInt("most_yuan"));
        model.setFrozenTime(rs.getInt("frozen_time"));
        return model;
    }
}
